package com.bridgeintelligent.tag.combination.pojo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@ApiModel
public class Combination implements Serializable {

    @ApiModelProperty("组合标签id")
    private String combinationId;

    @ApiModelProperty("组合标签名称")
    private String combinationName;

    @ApiModelProperty("业务类型")
    private String businessType;

    @ApiModelProperty("组合标签描述")
    private String combinationDes;

    @ApiModelProperty("组合标签英文名称")
    private String colName;

    @ApiModelProperty("业务场景")
    private String scenarious;

    @ApiModelProperty("业务部门")
    private String departId;

    @ApiModelProperty("业务负责人")
    private String manager;

    @ApiModelProperty("标签类型")
    private String classify;

    @ApiModelProperty("是否推荐")
    private boolean commended;

    @ApiModelProperty("存储目录")
    private String path;

    @ApiModelProperty("创建时间")
    private String createTime;

    @ApiModelProperty("最近更新时间")
    private String uptTime;

    @ApiModelProperty("申请时间")
    private String applicationTime;

    @ApiModelProperty("审批状态")
    private String approvalStatus;

    @ApiModelProperty("申请人")
    private String applicant;

    @ApiModelProperty("申请人名称")
    private String applicantName;

    @ApiModelProperty("审批人")
    private String approver;

    @ApiModelProperty("审批人名字")
    private String approverName;

    @ApiModelProperty("创建者")
    private String ownerId;

    @ApiModelProperty("创建者名称")
    private String ownerName;

    @ApiModelProperty("驳回原因")
    private String reject;

    @ApiModelProperty("当前最大序号-标签ID生成规则专用")
    private int maxIndex;

    @ApiModelProperty("标签序号")
    private int sortNum;

    @ApiModelProperty("更新频率")
    private String renew;

    @ApiModelProperty("产出规则")
    private String rule;

    @ApiModelProperty("查询条件")
    private String queryCriteria;

    private String statusName;

    //流程实例ID
    private String instanceId;

    //审批状态名称
    private String approvalStatusName;
    //审批类型名称
    private String approveTypeName;
    //审批类型ID
    private String approveType;

    private QueryModel queryModel;

    private List<QueryModel> queryModelList;

    private List<CombinationGroup> cgrouplist;

    private List<Filter> filterList;

    // 是否两个月内修改
    private boolean isnew;

    @ApiModelProperty("饱和度")
    private String bhdPercent;
    @ApiModelProperty("评分")
    private Long assessScore;
    @ApiModelProperty(value = "有效期 yyyy-MM-dd格式", required = true)
    private String validTime;
    @ApiModelProperty(value = "共享状态")
    private String sharedState;
    @ApiModelProperty(value = "状态")
    private String state;
    @ApiModelProperty(value = "数据状态")
    private String dataState;
    @ApiModelProperty(value = "是否删除 00 否 01 是")
    private String isDel;
    @ApiModelProperty(value = "是否有效  00 否 01 是")
    public String getStatus(){
        String current = DateFormatUtils.format(new Date(), "yyyy-MM-dd");
        if(StringUtils.compare(validTime, current)>=0&&!StringUtils.equals(state,"02")){
            if(StringUtils.equals(dataState, "0")){
                // 数据准备中
                return "02";
            }
            return "01";
        }
        return "00";
    }
}
